 # Triggers are in Province scope. The From Scope contains the settlement holder (character)
 # start trigger is in title scope.
 
 #<tag> = {
 #	desc = description used in the tooltip of the building
 #	trigger = used for tech requirement of the building, set to 0 if no requirement so it can be build automatically on new games
 #	build_cost = cost to build the building
 #	build_time = time to build, in days
 #	
 #	ai_creation_factor = weight that the AI uses to determine what building to build
 #	extra_tech_building_start = when starting a new game this building will be pre-built if the province has higher tech than the requirement + this + random 0-1
 #}
 
 # Castle
castle = {
	# Wall quality, gives fortlevel
	ca_wall_q_1 = {
		desc = ca_wall_q_1_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 0 }
		build_cost = 50
		build_time = 182
		fort_level = 0.5
		ai_creation_factor = 80
		
		extra_tech_building_start = 1.0
	}
	ca_wall_q_2 = {
		desc = ca_wall_q_2_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 1 }
		upgrades_from = ca_wall_q_1
		prerequisites = { ca_wall_1 }
		build_cost = 50
		build_time = 182
		fort_level = 0.5
		ai_creation_factor = 79

		extra_tech_building_start = 0.6
	}
	ca_wall_q_3 = {
		desc = ca_wall_q_3_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 3 }
		upgrades_from = ca_wall_q_2
		build_cost = 50
		build_time = 182
		fort_level = 0.5
		ai_creation_factor = 78
		
		extra_tech_building_start = 0.2
	}
	ca_wall_q_4 = {
		desc = ca_wall_q_4_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 5 }
		upgrades_from = ca_wall_q_3
		build_cost = 100
		build_time = 365
		fort_level = 1.0
		ai_creation_factor = 77
		
		extra_tech_building_start = 0.2
	}
	ca_wall_q_5 = {
		desc = ca_wall_q_5_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 7 }
		upgrades_from = ca_wall_q_4
		build_cost = 100
		build_time = 365
		fort_level = 1.0
		ai_creation_factor = 76

		extra_tech_building_start = 0.2
	}
	
	#Walls, gives fortlevel, levysize and income
	ca_wall_1 = {
		desc = ca_wall_1_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 0 }
		build_cost = 50
		build_time = 365
		fort_level = 0.5
		levy_size = 0.025
		tax_income = 0.2
		ai_creation_factor = 90
		
		extra_tech_building_start = 1.0
	}
	ca_wall_2 = {
		desc = ca_wall_2_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 2 }
		upgrades_from = ca_wall_1
		build_cost = 50
		build_time = 547 #1.5y
		fort_level = 0.5
		levy_size = 0.025
		tax_income = 0.2
		ai_creation_factor = 89
		
		extra_tech_building_start = 0.2
	}
	ca_wall_3 = {
		desc = ca_wall_3_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 4 }
		upgrades_from = ca_wall_2
		build_cost = 100
		build_time = 730 #2y
		fort_level = 1.0
		levy_size = 0.05
		tax_income = 0.2
		ai_creation_factor = 88

		extra_tech_building_start = 0.2
	}
	ca_wall_4 = {
		desc = ca_wall_4_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 6 }
		upgrades_from = ca_wall_3
		build_cost = 150
		build_time = 1095 #3y
		fort_level = 1.0
		levy_size = 0.05
		tax_income = 0.2
		ai_creation_factor = 87

		extra_tech_building_start = 0.2
	}
	ca_wall_5 = {
		desc = ca_wall_5_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 8 }
		upgrades_from = ca_wall_4
		build_cost = 150
		build_time = 1460 #4y
		fort_level = 1.5
		levy_size = 0.1
		tax_income = 0.5
		ai_creation_factor = 86

		extra_tech_building_start = 0.2
	}
	ca_con_wall_6 = { # Theodosian Walls
		potential = {
			FROMFROM = { title = b_constantinople }
		}
		desc = ca_con_wall_6_desc
		upgrades_from = ca_wall_5
		build_cost = 150
		build_time = 1460 #4y
		fort_level = 4.0
		ai_creation_factor = 86

		extra_tech_building_start = 0.0
	}

	#Keeps, gives levy and garrison size
	ca_keep_1 = {
		desc = ca_keep_1_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 0 }
		build_cost = 150
		build_time = 547 #1.5y
		levy_size = 0.05
		garrison_size = 0.05
		ai_creation_factor = 102
		
		extra_tech_building_start = 1.0
	}
	ca_keep_2 = {
		desc = ca_keep_1_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 0 }
		prerequisites = { ca_wall_1 }
		upgrades_from = ca_keep_1
		build_cost = 200
		build_time = 730 #2y
		levy_size = 0.1
		garrison_size = 0.1
		ai_creation_factor = 101

		extra_tech_building_start = 2.0
	}
	ca_keep_3 = {
		desc = ca_keep_1_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 2 }
		prerequisites = { ca_wall_2 }
		upgrades_from = ca_keep_2
		build_cost = 300
		build_time = 1095 #3y
		levy_size = 0.15
		garrison_size = 0.15
		ai_creation_factor = 100
		
		extra_tech_building_start = 1.0
	}
	ca_keep_4 = {	
		desc = ca_keep_1_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 4 }
		upgrades_from = ca_keep_3
		build_cost = 400
		build_time = 1460 #4y
		levy_size = 0.2
		garrison_size = 0.2
		ai_creation_factor = 99

		extra_tech_building_start = 0.2
	}
	ca_keep_5 = {
		desc = ca_keep_1_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 6 }
		upgrades_from = ca_keep_4
		build_cost = 500
		build_time = 2190 #6y
		levy_size = 0.25
		garrison_size = 0.2
		ai_creation_factor = 98

		extra_tech_building_start = 0.2
	}
	ca_keep_6 = {
		desc = ca_keep_1_desc
		trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 8 }
		upgrades_from = ca_keep_5
		build_cost = 500
		build_time = 2190 #6y
		levy_size = 0.3
		garrison_size = 0.2
		ai_creation_factor = 97
		
		extra_tech_building_start = 0.2
	}
	
	# Militia barracks, gives light infantry and archers.
	ca_militia_barracks_1 = {
		desc = ca_militia_barracks_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		build_cost = 100
		build_time = 365
		light_infantry = 80
		archers = 10
		ai_creation_factor = 100
		
		extra_tech_building_start = 1.0
	}
	ca_militia_barracks_2 = {
		desc = ca_militia_barracks_2_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 1 }
		prerequisites = { ca_wall_1 }
		upgrades_from = ca_militia_barracks_1
		build_cost = 120
		build_time = 547
		light_infantry = 50
		archers = 50
		ai_creation_factor = 99

		extra_tech_building_start = 2.0
	}
	ca_militia_barracks_3 = {
		desc = ca_militia_barracks_3_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 5 }
		upgrades_from = ca_militia_barracks_2
		build_cost = 200
		build_time = 1095
		light_infantry = 20
		archers = 90
		ai_creation_factor = 98

		extra_tech_building_start = 0.5
	}
	ca_militia_barracks_4 = {
		desc = ca_militia_barracks_3_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 7 }
		upgrades_from = ca_militia_barracks_3
		build_cost = 300
		build_time = 1095
		light_infantry = 30
		archers = 120
		ai_creation_factor = 98

		extra_tech_building_start = 0.5
	}

	#Training grounds, gives morale and reinforce rate
	ca_training_grounds_1 = {
		desc = ca_training_grounds_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		prerequisites = { ca_wall_2 }
		build_cost = 200
		build_time = 730
		land_morale = 0.1
		levy_reinforce_rate = 0.1
		retinuesize = 20
		ai_creation_factor = 89

		extra_tech_building_start = 1.2
	}
	ca_training_grounds_2 = {
		desc = ca_training_grounds_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 3 }
		upgrades_from = ca_training_grounds_1
		build_cost = 250
		build_time = 1095
		land_morale = 0.15
		levy_reinforce_rate = 0.15
		retinuesize = 20
		ai_creation_factor = 88
		
		extra_tech_building_start = 0.5
	}
	ca_training_grounds_3 = {
		desc = ca_training_grounds_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 6 }
		upgrades_from = ca_training_grounds_2
		build_cost = 300
		build_time = 2190
		land_morale = 0.2
		levy_reinforce_rate = 0.2
		retinuesize = 20
		ai_creation_factor = 88
		
		extra_tech_building_start = 0.2
	}
	
	# Barracks, gives heavy infantry and pikemen
	ca_barracks_1 = {
		desc = ca_barracks_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		build_cost = 100
		build_time = 365
		heavy_infantry = 30
		pikemen = 15
		ai_creation_factor = 105
		
		extra_tech_building_start = 1.0
	}
	ca_barracks_2 = {
		desc = ca_barracks_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		prerequisites = { ca_wall_1 }
		upgrades_from = ca_barracks_1
		build_cost = 120
		build_time = 547
		heavy_infantry = 40
		pikemen = 15
		ai_creation_factor = 104
		
		extra_tech_building_start = 1.8
	}
	ca_barracks_3 = {
		desc = ca_barracks_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 1 }
		prerequisites = { ca_wall_2 }
		upgrades_from = ca_barracks_2
		build_cost = 200
		build_time = 730
		heavy_infantry = 45
		pikemen = 20
		ai_creation_factor = 103

		extra_tech_building_start = 3.0
	}
	ca_barracks_4 = {
		desc = ca_barracks_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 3 }
		upgrades_from = ca_barracks_3
		build_cost = 300
		build_time = 1095
		heavy_infantry = 50
		pikemen = 25
		ai_creation_factor = 102

		extra_tech_building_start = 3.0
	}
	ca_barracks_5 = {
		desc = ca_barracks_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 5 }
		upgrades_from = ca_barracks_4
		build_cost = 400
		build_time = 2190
		heavy_infantry = 60
		pikemen = 25
		ai_creation_factor = 101

		extra_tech_building_start = 2.0
	}
	ca_barracks_6 = {
		desc = ca_barracks_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 7 }
		upgrades_from = ca_barracks_5
		build_cost = 500
		build_time = 2190
		heavy_infantry = 65
		pikemen = 30
		ai_creation_factor = 100

		extra_tech_building_start = 0.2
	}
	
	#Stable, gives light cavalry and some heavy cavalry
	ca_stable_1 = {
		desc = ca_stable_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		build_cost = 100
		build_time = 365
		light_cavalry = 35
		ai_creation_factor = 89
		
		extra_tech_building_start = 0.4
	}
	ca_stable_2 = {
		desc = ca_stable_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		prerequisites = { ca_wall_1 }
		upgrades_from = ca_stable_1
		build_cost = 120
		build_time = 547
		light_cavalry = 45
		ai_creation_factor = 88

		extra_tech_building_start = 0.8
	}
	ca_stable_3 = {
		desc = ca_stable_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 2 }
		prerequisites = { ca_wall_2 }
		upgrades_from = ca_stable_2
		build_cost = 200
		build_time = 730
		light_cavalry = 55
		ai_creation_factor = 87

		extra_tech_building_start = 0.2
	}
	ca_stable_4 = {
		desc = ca_stable_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 4 }
		upgrades_from = ca_stable_3
		build_cost = 300
		build_time = 1095
		light_cavalry = 55
		knights = 5
		ai_creation_factor = 86

		extra_tech_building_start = 0.2
	}
	ca_stable_5 = {
		desc = ca_stable_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 6 }
		upgrades_from = ca_stable_4
		build_cost = 400
		build_time = 2190
		light_cavalry = 55
		knights = 10
		ai_creation_factor = 85

		extra_tech_building_start = 0.2
	}
	ca_stable_6 = {
		desc = ca_stable_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 8 }
		upgrades_from = ca_stable_5
		build_cost = 500
		build_time = 2190
		light_cavalry = 55
		knights = 20
		ai_creation_factor = 85

		extra_tech_building_start = 0.2
	}
	
	#Castle town, gives income
	ca_town_1 = {
		desc = ca_town_1_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		build_cost = 100
		build_time = 365
		tax_income = 2
		ai_creation_factor = 100
		
		extra_tech_building_start = 0.5
	}
	ca_town_2 = {
		desc = ca_town_2_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 0 }
		prerequisites = { ca_wall_1 }
		upgrades_from = ca_town_1
		build_cost = 120
		build_time = 547
		tax_income = 2
		ai_creation_factor = 99

		extra_tech_building_start = 1.0
	}
	ca_town_3 = {
		desc = ca_town_3_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 2 }
		prerequisites = { ca_wall_2 }
		upgrades_from = ca_town_2
		build_cost = 200
		build_time = 730
		tax_income = 2
		ai_creation_factor = 98

		extra_tech_building_start = 0.2
	}
	ca_town_4 = {
		desc = ca_town_4_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 4 }
		upgrades_from = ca_town_3
		build_cost = 300
		build_time = 1095
		tax_income = 2
		ai_creation_factor = 97

		extra_tech_building_start = 0.2
	}
	ca_town_5 = {
		desc = ca_town_4_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 6 }
		upgrades_from = ca_town_4
		build_cost = 400
		build_time = 2190
		tax_income = 2
		ai_creation_factor = 96

		extra_tech_building_start = 0.2
	}
	ca_town_6 = {
		desc = ca_town_5_desc
		trigger = { TECH_CASTLE_CONSTRUCTION = 8 }
		upgrades_from = ca_town_5
		build_cost = 500
		build_time = 2190
		tax_income = 2
		ai_creation_factor = 96

		extra_tech_building_start = 0.2
	}
	
	ca_shipyard_1 = {
		desc = shipyard_desc
		port = yes
		trigger = { TECH_NAVAL = 1 }
		build_cost = 100
		build_time = 365
		galleys = 4
		ai_creation_factor = 95
		
		extra_tech_building_start = 0.3
	}
	
	ca_shipyard_2 = {
		desc = shipyard_desc
		port = yes
		trigger = { TECH_NAVAL = 2 }
		upgrades_from = ca_shipyard_1
		build_cost = 100
		build_time = 730
		galleys = 5
		ai_creation_factor = 94
		
		extra_tech_building_start = 0.3
	}
	
	ca_shipyard_3 = {
		desc = shipyard_desc
		port = yes
		trigger = { TECH_NAVAL = 3 }
		upgrades_from = ca_shipyard_2
		build_cost = 100
		build_time = 1095
		galleys = 6
		ai_creation_factor = 93
		
		extra_tech_building_start = 0.3
	}
	
	ca_shipyard_4 = {
		desc = shipyard_desc
		port = yes
		trigger = { TECH_NAVAL = 4 }
		upgrades_from = ca_shipyard_3
		build_cost = 100
		build_time = 1460
		galleys = 7
		ai_creation_factor = 92
		
		extra_tech_building_start = 0.3
	}
}
